package com.example.boot.controller;

import com.example.boot.mapper.UserMapper;
import com.example.boot.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
@Slf4j
public class UserController {

    @Autowired
    UserMapper userMapper;
    @Autowired
    ApplicationContext ctx;

    @ResponseBody
    @RequestMapping("/a")
    public User a() {
        User user = userMapper.getUserById(1);
        log.info("test");
        return user;
    }

    @ResponseBody
    @RequestMapping("/b")
    public String b() {

        return "success";
    }

    @GetMapping("/index")
    public String index() {
        return "index";
    }



}
